%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/polymorphic/only"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 7, 9, 10, 21, 43, 70, 75, 11<br />2: Lambda[13], Lambda[50]<br />3: PgUnionAll[8]<br />4: Connection[12]<br />5: ConnectionItems[14]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 12, 21, 14, 11, 50, 70, 75<br /><br />ROOT Connectionᐸ8ᐳ[12]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 21, 11, 50, 70, 75<br /><br />ROOT __Item{3}ᐸ14ᐳ[17]"):::bucket
    Bucket4("Bucket 4 (polymorphic)<br />__typename: Access[24]<br />Deps: 24, 11, 25, 50, 70, 75"):::bucket
    Bucket5("Bucket 5 (polymorphicPartition)<br />|AwsApplication<br />Deps: 11, 25, 50, 70<br />ᐳAwsApplication<br /><br />1: PgSelect[26]<br />2: PgSelectRows[31]<br />ᐳ: 30, 32, 41, 44<br />3: PgUnionAll[45]<br />4: Connection[49]<br />5: ConnectionItems[58]"):::bucket
    Bucket6("Bucket 6 (polymorphicPartition)<br />|GcpApplication<br />Deps: 11, 25, 50, 75<br />ᐳGcpApplication<br /><br />1: PgSelect[34]<br />2: PgSelectRows[39]<br />ᐳ: 38, 40, 42, 51<br />3: PgUnionAll[52]<br />4: Connection[56]<br />5: ConnectionItems[61]"):::bucket
    Bucket9("Bucket 9 (listItem)<br />Deps: 70, 11<br /><br />ROOT __Item{9}ᐸ58ᐳ[64]"):::bucket
    Bucket10("Bucket 10 (listItem)<br />Deps: 75, 11<br /><br />ROOT __Item{10}ᐸ61ᐳ[66]"):::bucket
    Bucket11("Bucket 11 (combined)<br />Deps: 11"):::bucket
    Bucket12("Bucket 12 (polymorphic)<br />__typename: Access[79]<br />Deps: 79, 11, 80"):::bucket
    Bucket13("Bucket 13 (polymorphicPartition)<br />|FirstPartyVulnerability<br />Deps: 11, 80<br />(2) ...ᐳFirstPartyVulnerability<br /><br />1: PgSelect[81]<br />2: PgSelectRows[86]<br />ᐳ: 85, 87, 96, 98, 100"):::bucket
    Bucket14("Bucket 14 (polymorphicPartition)<br />|ThirdPartyVulnerability<br />Deps: 11, 80<br />(2) ...ᐳThirdPartyVulnerability<br /><br />1: PgSelect[89]<br />2: PgSelectRows[94]<br />ᐳ: 93, 95, 97, 99, 101"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket5 & Bucket6
    Bucket5 --> Bucket9
    Bucket6 --> Bucket10
    Bucket9 --> Bucket11
    Bucket10 --> Bucket11
    Bucket11 --> Bucket12
    Bucket12 --> Bucket13 & Bucket14

    %% plan dependencies
    PgUnionAll8[["PgUnionAll[8∈0] ➊<br />ᐸAwsApplication,GcpApplicationᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13[["Lambda[13∈0] ➊<br />ᐸlimitToTypesᐳ<br />More deps:<br />- Constantᐸ[ 'GcpApplication', 'AwsApplication' ]ᐳ[7]"]]:::unbatchedplan
    Lambda13 --> PgUnionAll8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 7"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    Connection12[["Connection[12∈0] ➊<br />ᐸ8ᐳ"]]:::plan
    PgUnionAll8 --> Connection12
    ConnectionItems14[["ConnectionItems[14∈0] ➊"]]:::plan
    Connection12 --> ConnectionItems14
    Lambda50[["Lambda[50∈0] ➊<br />ᐸlimitToTypesᐳ<br />More deps:<br />- Constantᐸ[ 'ThirdPartyVulnerability' ]ᐳ[43]"]]:::unbatchedplan
    List22{{"List[22∈3]<br />ᐸ19,20,21ᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[21]"}}:::plan
    Access19{{"Access[19∈3]<br />ᐸ17.0ᐳ"}}:::plan
    Access20{{"Access[20∈3]<br />ᐸ17.1ᐳ"}}:::plan
    Access19 & Access20 --> List22
    __Item17[/"__Item[17∈3]<br />ᐸ14ᐳ"\]:::itemplan
    ConnectionItems14 ==> __Item17
    __Item17 --> Access19
    __Item17 --> Access20
    Lambda23{{"Lambda[23∈3]<br />ᐸtoSpecifierᐳ"}}:::plan
    List22 --> Lambda23
    Access24{{"Access[24∈3]<br />ᐸ23.__typenameᐳ"}}:::plan
    Lambda23 --> Access24
    Access25{{"Access[25∈3]<br />ᐸ23.idᐳ"}}:::plan
    Lambda23 --> Access25
    PgUnionAll45[["PgUnionAll[45∈5]^<br />ᐸFirstPartyVulnerability,ThirdPartyVulnerabilityᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression44{{"PgClassExpression[44∈5]^<br />ᐸ__aws_appl...ons__.”id”ᐳ"}}:::plan
    PgClassExpression44 & Lambda50 --> PgUnionAll45
    PgSelect26[["PgSelect[26∈5]<br />ᐸaws_applicationsᐳ<br />ᐳAwsApplication<br />More deps:<br />- Object[11]"]]:::plan
    Access25 --> PgSelect26
    First30{{"First[30∈5]^"}}:::plan
    PgSelectRows31[["PgSelectRows[31∈5]^"]]:::plan
    PgSelectRows31 --> First30
    PgSelect26 --> PgSelectRows31
    PgSelectSingle32{{"PgSelectSingle[32∈5]^<br />ᐸaws_applicationsᐳ"}}:::plan
    First30 --> PgSelectSingle32
    PgClassExpression41{{"PgClassExpression[41∈5]^<br />ᐸ__aws_appl..._.”aws_id”ᐳ"}}:::plan
    PgSelectSingle32 --> PgClassExpression41
    PgSelectSingle32 --> PgClassExpression44
    Connection49[["Connection[49∈5]^<br />ᐸ45ᐳ"]]:::plan
    PgUnionAll45 --> Connection49
    ConnectionItems58[["ConnectionItems[58∈5]^"]]:::plan
    Connection49 --> ConnectionItems58
    PgUnionAll52[["PgUnionAll[52∈6]^<br />ᐸFirstPartyVulnerability,ThirdPartyVulnerabilityᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression51{{"PgClassExpression[51∈6]^<br />ᐸ__gcp_appl...ons__.”id”ᐳ"}}:::plan
    PgClassExpression51 & Lambda50 --> PgUnionAll52
    PgSelect34[["PgSelect[34∈6]<br />ᐸgcp_applicationsᐳ<br />ᐳGcpApplication<br />More deps:<br />- Object[11]"]]:::plan
    Access25 --> PgSelect34
    First38{{"First[38∈6]^"}}:::plan
    PgSelectRows39[["PgSelectRows[39∈6]^"]]:::plan
    PgSelectRows39 --> First38
    PgSelect34 --> PgSelectRows39
    PgSelectSingle40{{"PgSelectSingle[40∈6]^<br />ᐸgcp_applicationsᐳ"}}:::plan
    First38 --> PgSelectSingle40
    PgClassExpression42{{"PgClassExpression[42∈6]^<br />ᐸ__gcp_appl..._.”gcp_id”ᐳ"}}:::plan
    PgSelectSingle40 --> PgClassExpression42
    PgSelectSingle40 --> PgClassExpression51
    Connection56[["Connection[56∈6]^<br />ᐸ52ᐳ"]]:::plan
    PgUnionAll52 --> Connection56
    ConnectionItems61[["ConnectionItems[61∈6]^"]]:::plan
    Connection56 --> ConnectionItems61
    List71{{"List[71∈9]^<br />ᐸ68,69,70ᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[70]"}}:::plan
    Access68{{"Access[68∈9]^<br />ᐸ64.0ᐳ"}}:::plan
    Access69{{"Access[69∈9]^<br />ᐸ64.1ᐳ"}}:::plan
    Access68 & Access69 --> List71
    __Item64[/"__Item[64∈9]<br />ᐸ58ᐳ<br />ᐳAwsApplication"\]:::itemplan
    ConnectionItems58 ==> __Item64
    __Item64 --> Access68
    __Item64 --> Access69
    Lambda72{{"Lambda[72∈9]^<br />ᐸtoSpecifierᐳ"}}:::plan
    List71 --> Lambda72
    List76{{"List[76∈10]^<br />ᐸ73,74,75ᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[75]"}}:::plan
    Access73{{"Access[73∈10]^<br />ᐸ66.0ᐳ"}}:::plan
    Access74{{"Access[74∈10]^<br />ᐸ66.1ᐳ"}}:::plan
    Access73 & Access74 --> List76
    __Item66[/"__Item[66∈10]<br />ᐸ61ᐳ<br />ᐳGcpApplication"\]:::itemplan
    ConnectionItems61 ==> __Item66
    __Item66 --> Access73
    __Item66 --> Access74
    Lambda77{{"Lambda[77∈10]^<br />ᐸtoSpecifierᐳ"}}:::plan
    List76 --> Lambda77
    Access79{{"Access[79∈11]^<br />ᐸ78.__typenameᐳ"}}:::plan
    __Value78:::plan@{shape: docs, label: "__Combined[78∈11]<br />ᐳAwsApplication<br />ᐳGcpApplication"}
    __Value78 --> Access79
    Access80{{"Access[80∈11]^<br />ᐸ78.idᐳ"}}:::plan
    __Value78 --> Access80
    PgSelect81[["PgSelect[81∈13]<br />ᐸfirst_party_vulnerabilitiesᐳ<br />(2) ...ᐳFirstPartyVulnerability<br />More deps:<br />- Object[11]"]]:::plan
    Access80 --> PgSelect81
    First85{{"First[85∈13]^"}}:::plan
    PgSelectRows86[["PgSelectRows[86∈13]^"]]:::plan
    PgSelectRows86 --> First85
    PgSelect81 --> PgSelectRows86
    PgSelectSingle87{{"PgSelectSingle[87∈13]^<br />ᐸfirst_party_vulnerabilitiesᐳ"}}:::plan
    First85 --> PgSelectSingle87
    PgClassExpression96{{"PgClassExpression[96∈13]^<br />ᐸ__first_pa...ies__.”id”ᐳ"}}:::plan
    PgSelectSingle87 --> PgClassExpression96
    PgClassExpression98{{"PgClassExpression[98∈13]^<br />ᐸ__first_pa...s__.”name”ᐳ"}}:::plan
    PgClassExpression96 o--o PgClassExpression98
    PgClassExpression100{{"PgClassExpression[100∈13]^<br />ᐸ__first_pa...team_name”ᐳ"}}:::plan
    PgClassExpression98 o--o PgClassExpression100
    PgSelect89[["PgSelect[89∈14]<br />ᐸthird_party_vulnerabilitiesᐳ<br />(2) ...ᐳThirdPartyVulnerability<br />More deps:<br />- Object[11]"]]:::plan
    Access80 --> PgSelect89
    First93{{"First[93∈14]^"}}:::plan
    PgSelectRows94[["PgSelectRows[94∈14]^"]]:::plan
    PgSelectRows94 --> First93
    PgSelect89 --> PgSelectRows94
    PgSelectSingle95{{"PgSelectSingle[95∈14]^<br />ᐸthird_party_vulnerabilitiesᐳ"}}:::plan
    First93 --> PgSelectSingle95
    PgClassExpression97{{"PgClassExpression[97∈14]^<br />ᐸ__third_pa...ies__.”id”ᐳ"}}:::plan
    PgSelectSingle95 --> PgClassExpression97
    PgClassExpression99{{"PgClassExpression[99∈14]^<br />ᐸ__third_pa...s__.”name”ᐳ"}}:::plan
    PgClassExpression97 o--o PgClassExpression99
    PgClassExpression101{{"PgClassExpression[101∈14]^<br />ᐸ__third_pa...ndor_name”ᐳ"}}:::plan
    PgClassExpression99 o--o PgClassExpression101

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgUnionAll8,Access9,Access10,Object11,Connection12,Lambda13,ConnectionItems14,Lambda50 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item17,Access19,Access20,List22,Lambda23,Access24,Access25 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgSelect26,First30,PgSelectRows31,PgSelectSingle32,PgClassExpression41,PgClassExpression44,PgUnionAll45,Connection49,ConnectionItems58 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgSelect34,First38,PgSelectRows39,PgSelectSingle40,PgClassExpression42,PgClassExpression51,PgUnionAll52,Connection56,ConnectionItems61 bucket6
    classDef bucket9 stroke:#ff0000
    class Bucket9,__Item64,Access68,Access69,List71,Lambda72 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,__Item66,Access73,Access74,List76,Lambda77 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,__Value78,Access79,Access80 bucket11
    classDef bucket12 stroke:#4169e1
    class Bucket12 bucket12
    classDef bucket13 stroke:#3cb371
    class Bucket13,PgSelect81,First85,PgSelectRows86,PgSelectSingle87,PgClassExpression96,PgClassExpression98,PgClassExpression100 bucket13
    classDef bucket14 stroke:#a52a2a
    class Bucket14,PgSelect89,First93,PgSelectRows94,PgSelectSingle95,PgClassExpression97,PgClassExpression99,PgClassExpression101 bucket14

    Lambda72 -.-x __Value78
    Lambda77 -.-x __Value78
